package com.google.code.gronono.jarseeker.ui;

import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;

public class JarSeekerPanel extends JPanel {
	/** serialVersionUID */
	private static final long serialVersionUID = 711382645532597749L;
	
	private JTable resultTable;
	private JTextField classField;
	private JTextField dirField;
	private JLabel dirLabel;
	private JButton browserBtn;
	private JLabel classLabel;
	private JButton searchBtn;

	private JScrollPane scrollPane;
    
    public JarSeekerPanel() {
        createComponents();
        placeComponents();
    }
   
	private void createComponents() {
        dirLabel = new JLabel();
        dirField = new JTextField();
        browserBtn = new JButton();
        classLabel = new JLabel();
        classField = new JTextField();
        resultTable = new JTable();
        scrollPane = new JScrollPane(resultTable);
        searchBtn = new JButton();
    }
	
	private void placeComponents() {
		GroupLayout layout = new GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(Alignment.LEADING)
                    .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(dirLabel)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(dirField, GroupLayout.PREFERRED_SIZE, 300, GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(browserBtn)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(classLabel)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(classField, GroupLayout.PREFERRED_SIZE, 300, GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(searchBtn)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(dirLabel)
                    .addComponent(dirField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(browserBtn)
                    .addComponent(classLabel)
                    .addComponent(classField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(searchBtn))
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 295, Short.MAX_VALUE)
                .addContainerGap())
        );
	}

	public JTable getResultTable() {
		return resultTable;
	}

	public JTextField getClassField() {
		return classField;
	}

	public JTextField getDirField() {
		return dirField;
	}

	public JLabel getDirLabel() {
		return dirLabel;
	}

	public JButton getBrowserBtn() {
		return browserBtn;
	}

	public JLabel getClassLabel() {
		return classLabel;
	}

	public JButton getSearchBtn() {
		return searchBtn;
	}
}
